package cn.springcloud.fix.demo.design.singleton;

/**
 * 每次getInstance都上锁，性能较差
 */
public class Singleton2 {

    private Singleton2() {
    }

    private static Singleton2 single = null;

    public static synchronized Singleton2 getInstance() {
        if (single == null) {
            single = new Singleton2();
        }
        return single;
    }
}
